package cn.cpf.tool.doc.pdf;

/**
 * <b>Description : </b>
 *
 * @author CPF
 * Date: 2020/5/7 10:03
 */
public class BookmarkItem {
    private static final int INVALID_PAGENUM = -2147483648;

    private static final String INVALID_PAGESTRING = "";

    private String name = "";

    private int level = 0;

    private int pageNum = Integer.MIN_VALUE;

    public BookmarkItem() {}

    public BookmarkItem(int level, String name, int pageNum) {
        this.level = level;
        this.name = name;
        this.pageNum = pageNum;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getLevel() {
        return this.level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public int getPageNum() {
        return this.pageNum;
    }

    public boolean isPageNumOK() {
        return (this.pageNum != Integer.MIN_VALUE);
    }

    public String getPageNumString(int basePage) {
        if (isPageNumOK())
            return String.valueOf(this.pageNum + 1 - basePage);
        return "";
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }
}
